[OpenGL] 자주쓰는 OpenGL함수들 (favorite OpenGL Functions!!)
이미지출처 : techie-buzz.com
———-
Shape
———-
Shape.draw();
GLU.gluCylinder(QUADRIC, RADIUS, RADIUS, height, slices, stacks);
GLU.gluDisk(QUADRIC, Inner RADIUS, Outer RADIUS, slices,
stacks);
GLU.gluSphere(QUADRIC,RADIUS, slices, stacks);
#DISPLAY LIST With GL_COMPILE
GL.glNewList(this.getListIndex(), GL.GL_COMPILE);
…
GL.glEndList();
GL.glBegin(TYPE);
GL.glVertex3f(AxisX,AxisY,AxisZ);
GL.glEnd();
#TYPES
GL.GL_POINTS
GL.GL_LINE_LOOP
GL.GL_LINES
GL.GL_QUADS
GL.GL_LINE_STRIP (CURVE -> Multi Line)
———-
translate
———-
GL.glLoadIdentity();
GL.glPushMatrix();
GL.glPopMatrix();
GL.glTranslatef(AxisX,AxisY,AxisZ);
GL.glRotatef(Angle, AxisX,AxisY,AxisZ);
———-
size
———-
GL.glPointSize(float size);
GL.glLineWidth(float width);
———-
colors
———-
GL.glColor3f(float red,float green,float blue);
GL.glColor4f(float red,float green,float blue,float alpha);
GL.glColor4fv(float args[]);
———-
Effects
———-
GL.glBlendFunc() :
blend function’s source and destination rate setting.
EX)
GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
GL.glLightfv() : light setting.
EX)
GL.glLightfv(GL.GL_LIGHT1,
GL.GL_DIFFUSE,
new float[] {1.0f, 1.0f, 1.0f, 1.0f});
GL.glLightfv(GL.GL_LIGHT1,
GL.GL_AMBIENT,
new float[] {0.5f, 0.5f, 0.5f, 1.0f});
GL.glLightfv(GL.GL_LIGHT1,
GL.GL_POSITION,
new float[] {-50.f, 50.0f, 100.0f, 1.0f});
GL.glEnable() : enable effects.
EX)
GL.glEnable(GL.GL_BLEND);
GL.glEnable(GL.GL_LIGHTING);
GL.glEnable(GL.GL_COLOR_MATERIAL);
Reference
————————-
Using OpenGL in SWT Applications :
http://www.eclipse.org/swt/opengl/
http://www.eclipse.org/articles/Article-SWT-OpenGL/opengl.html
NeHe : http://nehe.gamedev.net/